package com.example.quce.controller;
import com.example.quce.common.R;
import com.example.quce.entity.GingNang;
import com.example.quce.mapper.GingnangMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Qingnang")
@RequiredArgsConstructor
public class QingNangController {

    @Autowired
    private final GingnangMapper gingnangMapper;

    @PostMapping("/Qanswer")
    public R Qanswer(@RequestBody GingNang request) {
        GingNang q = gingnangMapper.findByID(request.getTestNumber());
        System.out.println("!!!!!request.getTestNumber().toString():"+request.getTestNumber());
        if (q==null) {
            return R.error("该数字没有对应数据");
        }

        return R.ok(q.getAnswer());
 }
}
